using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

namespace LabMS.Web.CoursePlan
{
    public partial class CoursePreview : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack) 
            {
                DataBinds();
            }
        }
        protected void DataBinds() 
        {
            LabMS.Model.Course model = new LabMS.Model.Course();
            LabMS.BLL.Course Course = new LabMS.BLL.Course();

            model = Course.GetModel(Convert.ToInt32(QueryString));
            tb_CourseCode.Text = model.Course_Code;
            tb_CourseName.Text = model.Course_Name;
            tb_ExpHouse.Text = model.Course_ExprientHouse.ToString();
            tb_EngName.Text = model.EnglishName;

            //
            List<LabMS.Model.Dictionary> ls = new List<LabMS.Model.Dictionary>();
            LabMS.BLL.DictionaryClass DicClass = new LabMS.BLL.DictionaryClass();

            LabMS.Model.DictionaryClass ds = new LabMS.Model.DictionaryClass();

            LabMS.BLL.Dictionary Dic = new LabMS.BLL.Dictionary();

            List<LabMS.Model.DictionaryClass> lsDic = new List<LabMS.Model.DictionaryClass>();

            lsDic = DicClass.GetModelList("Code='CourseType'");
            if (lsDic.Count != 0) 
            {
                ds = lsDic[0];
                ls = Dic.GetModelList("DClass='" + ds.Code + "'");
                ddl_CourseType.DataSource = ls;
                ddl_CourseType.DataTextField = "Name";
                ddl_CourseType.DataValueField = "Code";
                ddl_CourseType.DataBind();
            }

            

        }
        protected string QueryString 
        {
            get { return Request.QueryString["ID"].ToString().Trim(); }
        }
    }
}
